#ifndef __AS_PROGRESS_BAR__H__
#define __AS_PROGRESS_BAR__H__

#include "ASControl.h"
#include "ASImage.h"

#define AS_BAR_FILL_COLOR_MAX_CNTS 4

typedef enum
{
    AS_PB_TYPE_COLOR,
    AS_PB_TYPE_IMAGE,

    AS_PB_TYPE_MAX
} as_progressbar_type;

typedef struct
{
    /* base */
    as_control base;

    /* attributes */
    as_progressbar_type type;
    ASINT percent;//[0,100]
    as_image* bg_tail_img;
    as_image* bg_tile_img;
    as_image* fg_tail_img;
    as_image* fg_tile_img;

    ASINT bg_frame_color;
    ASINT bg_fill_color;
    ASINT fg_fill_color_counts;
    ASINT fg_fill_colors[AS_BAR_FILL_COLOR_MAX_CNTS];
    as_rect valid_show_area;//just show in this area

    /* methods */
    as_ret (*set_percent)(as_control* ctrl_p, ASINT percent);
    as_ret (*update)(as_control* ctrl_p);

    as_ret (*set_bg_img)(as_control* ctrl_p, ASWSTR tail_path, ASWSTR tile_path, as_image_src_type type);
    as_ret (*set_fg_img)(as_control* ctrl_p, ASWSTR tail_path, ASWSTR tile_path, as_image_src_type type);

    as_ret (*set_bg_frame_color)(as_control* ctrl_p, ASINT color);
    as_ret (*set_bg_fill_color)(as_control* ctrl_p, ASINT color);
    as_ret (*set_fg_color)(as_control* ctrl_p, ASINT color_cnts, ASINT* colors);
    as_ret (*set_valid_area)(as_control* ctrl_p, as_rect valid_area);

} as_progressbar;

as_progressbar* as_ctrl_progressbar_create(as_rect area, as_progressbar_type type);

as_ret as_ctrl_progressbar_destory(as_progressbar* progress_p);

#endif//__AS_PROGRESS_BAR__H__